package io.gitee.yth.design.pattern.test.core.pattern.creational.factory.pizzafactory;

import io.gitee.yth.design.pattern.test.core.pattern.creational.factory.pizza.CheesePizza;
import io.gitee.yth.design.pattern.test.core.pattern.creational.factory.pizza.GreekPizza;
import io.gitee.yth.design.pattern.test.core.pattern.creational.factory.pizza.PepperPizza;
import io.gitee.yth.design.pattern.test.core.pattern.creational.factory.pizza.Pizza;

/**
 * 简单工厂模式 -- 静态工厂
 * <p>
 * 静态有静态的好处，不是静态的有不是静态的好处
 *
 * @author yth
 * @since 2023-04-17-1:11
 */
public class PizzaSimpleFactory2 {
    public static Pizza createPizza(String orderType) {
        switch (orderType) {
            case "greek":
                return new GreekPizza();
            case "cheese":
                return new CheesePizza();
            case "pepper":
                return new PepperPizza();
            default:
                return null;
        }
    }

}
